1. Field of the Invention
The present invention relates to a method for detecting moving objects, and more particularly, to a method for detecting moving objects by comparing video images.
2. Description of the Prior Art
A prior art method for detecting moving objects determines with the help of a calculator whether there is any object moving. This method is used for comparing video images generated by a camera. The calculator can select a first image and a second image from the video images and compare the images with each other so as to determine if any moving object exists. In general, when there is an object moving within the view filmed by the camera, pixels of the video images vary with movement of the object. Therefore, the calculator can determine whether there is any object moving within the view filmed by the camera according to the variation of pixels of the first image and the second image.
Please refer to FIG. 1 and FIG. 2. FIG. 1 is a monitor system 50 according to the prior art. FIG. 2 is a block diagram of the monitor system 50 shown in FIG. 1. The monitor system 50 is used for detecting whether any moving object exists within the view 52 by using a predetermined detection method. The monitor system 50 comprises a camera 20 for filming the view 52 to generate a plurality of video images 22 and a calculator 30 for selecting a first image 24 and a second image 26 from the video images 22. The calculator 30 compares the second image 26 with the first image 24 according to the predetermined detection method so as to determine whether any moving object exists within the view 52. When the calculator 30 determines whether any moving object exists within the view 52, the calculator 30 compares each pixel of the first image 24 with a corresponding pixel of the second image 26 so as to count a total number of different pixels between the two images 24, 26. If the total number of different pixels is greater than a predetermined number, the monitor system 50 determines that there is at least one object moving within the view 52. Oppositely, if the total number of different pixels is not greater than the predetermined number, the monitor system 50 determines that there is no object moving within the view 52.
However, the method adopted by the monitor system 50 for detecting moving objects within the view 52 has an obvious disadvantage in that the monitor system 50 may incorrectly judge when the global environment of the view 52 is changed suddenly. For example, when the view 52 is suddenly illuminated by a light source, i.e. a light bulb, the calculator 30 selects a video image 22 generated before the light source illuminated the view 52 as the first image 24 and selects another video image 22 generated when the light source illuminates the view 52 as the second image 24. And, during the time interval between when the camera 20 generates the first image 24 and the second image 26, there is not any object moving within the view 52. Because the second image 26 is generated when the view 52 is illuminated, most of the pixels of the second image 26 have greater brightness than the corresponding pixels of the first image 24. The total number of different pixels between the two images 24, 26, thus, increases substantially, and the monitor system 50 makes a wrong determination.